﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static _01_Tower3._0.Hero;
using static System.Net.Mime.MediaTypeNames;
using static _01_Tower3._0.Map;
using static _01_Tower3._0.ToolMenu;

namespace _01_Tower3._0
{
    internal class SceneMap1 : IScene
    {
        Map map;
        Hero hero;
        CombatSystem cs;
        ToolMenu toolMenu;
        Game game;

        DialogSystem ds;

        public static List<Enemy> slime;

        public static List<Enemy> goblin;

        static public Pos pos;


        public string Name => "SceneMap1";

        public SceneMap1(CombatSystem cs, ToolMenu toolMenu,Map map, DialogSystem ds,Hero hero)
        {
            this.cs = cs;
            this.toolMenu = toolMenu;
            this.map = map;
            this.hero = hero;
            this.ds = ds;
        }

        public void Init()
        {
            map.Init();
            hero.Init(map, cs, toolMenu,ds);
            slime = new List<Enemy>();
            slime.Add(new Enemy("史莱姆", 10, 30, 21, 15, map));
            slime.Add(new Enemy("史莱姆2", 20, 30, 22, 15, map));
            slime.Add(new Enemy("史莱姆3", 40, 30, 23, 15, map));
            slime.Add(new Enemy("史莱姆4", 60, 30, 24, 15, map));
            slime.Add(new Enemy("史莱姆5", 80, 30, 25, 15, map));
            slime.Add(new Enemy("史莱姆6", 100, 30, 26, 15, map));
            goblin = new List<Enemy>();
            goblin.Add(new Enemy("哥布林", 10, 30, 21, 15, map));
            goblin.Add(new Enemy("哥布林2", 20, 30, 22, 15, map));
            goblin.Add(new Enemy("哥布林3", 40, 30, 23, 15, map));
            goblin.Add(new Enemy("哥布林4", 60, 30, 24, 15, map));
            goblin.Add(new Enemy("哥布林5", 80, 30, 25, 15, map));
            goblin.Add(new Enemy("哥布林6", 100, 30, 26, 15, map));
        }
        
        public void Input()
        {
            if (InputSystem.Instance.IsKeyPressed(ConsoleKey.O))
            {
                isOpen = true;
                SceneManger.sceneName = "SceneMap1";
                SceneManger.instance.ChangeSceneByName("SceneBag");
            }
            if (InputSystem.Instance.IsKeyPressed(ConsoleKey.Escape))
            {
                SceneManger.sceneName = "SceneMap1";
                SceneManger.instance.ChangeSceneByName("SceneMenu");
            }
            hero.Input();
        }
        
        public void Update()
        {
            hero.Update();
            //for (int i = 0; i < enemies.Count; i++)
            //{
            //    enemies[i].Update();
            //}
        }
        public void FixUpdate()
        {
            hero.FixUpdate();
        }
        public void Render()
        {
            InfoSystem.Instance.PrintInfo();
            map.Render();
            hero.Render();
        }
        public void End()
        {
             
        }

    }
}
